package com.wei;

import java.util.stream.IntStream;

/**
 * @Author :sunwei
 * @Description:
 * @Date create in 22:38  2021/5/20
 * @Modified by:
 */
public class ThreadAPITest {

    public static void main(String[] args) throws InterruptedException {
        Thread t = new Thread(()->{
            IntStream.range(0, 1000).forEach((i)->System.out.println(Thread.currentThread().getName()+": "+i));
        },"thread 1");
        Thread t2 = new Thread(()->{
            IntStream.range(0, 1000).forEach((i)->System.out.println(Thread.currentThread().getName()+": "+i));
        },"thread 2");

        t.start();
        t2.start();
        t.join();
        t2.join();

        System.out.println("all join thread done!");
        IntStream.range(0, 1000).forEach((i)->System.out.println(Thread.currentThread().getName()+": "+i));
    }
}
